<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8">
    <title>微信安全支付</title>
	<script type="text/javascript" src="__STATICS__/js/qrcode.js" ></script>
	<script type="text/javascript" src="__STATICS__/js/Base.js" ></script>
	<script type="text/javascript" src="__STATICS__/js/prototype.js" ></script>
	<script type="text/javascript" src="__STATICS__/js/mootools.js" ></script>
	<script type="text/javascript" src="__STATICS__/js/Ajax/ThinkAjax.js" ></script>
	<script type="text/javascript" src="__STATICS__/plugins/jquery.min.js" ></script>
	<script type="text/javascript" src="__STATICS__/plugins/layer/layer.js" charset="utf-8" ></script>
	<script language="JavaScript">
		var goback = {$goback};
		var order_id = {$order_id};
		function Check()
		{
			var out_trade_no = "<?php echo $out_trade_no; ?>";
			$.post("{:U('Pay/Weixinpay/orderQuery')}",{out_trade_no:out_trade_no},function(msg){
				if(msg == 'SUCCESS'){
					if(goback == 1){
						$.post("{:U('goback')}",{order_id:order_id},function(dt){
							if(dt){
								layer.msg('已支付成功，请刷新查看订单详情。',{time: 5000, icon:1});
							}else{
								Check();
							}
						});
					}else{
						parent.goback(out_trade_no);
					}
				}
			});
	    	//ThinkAjax.send("{:U('Pay_success/Weixinpay/orderQuery')}",'ajax=1&out_trade_no='+out_trade_no,'','result');
	    	//var result_msg=documnet.getElementById("result").innerHTML;
	    	//alert(result_msg);
	    }
	    window.setInterval("Check()",3000); 
	    
	</script>
	<?php $_SESSION['i'] = 30;?>
</head>
<body>
	<center>
	<div id="result"></div>
	<div id="list"></div>
	</center>
    <div align="center" id="qrcode">
    </div>
    <div align="center">
        <p>订单号：<eq name='goback' value="1">{$order_sn}<else/>{$out_trade_no}</eq></p>
    </div>
    <!-- <div align="center">
        <form  action="{:U('Pay_success/Weixinpay/orderQuery')}" method="post">
            <input name="out_trade_no" type='hidden' value="<?php echo $out_trade_no; ?>">
            <button type="submit" >查询订单状态</button>
        </form>
    </div>
    <br>
    <div align="center">
        <form  action="./refund.php" method="post">
            <input name="out_trade_no" type='hidden' value="<?php echo $out_trade_no; ?>">
            <input name="refund_fee" type='hidden' value="1">
            <button type="submit" >申请退款</button>
        </form>
    </div>
    <br>
    <div align="center">
        <a href="../index.php">返回首页</a>
    </div> -->
</body>
    	<script type="text/javascript" src="__STATICS__/js/qrcode.js"></script>
    <script>
        if(<?php echo $unifiedOrderResult["code_url"] != NULL; ?>)
        {
            var url = "<?php echo $code_url;?>";
            //参数1表示图像大小，取值范围1-10；参数2表示质量，取值范围'L','M','Q','H'
            var qr = qrcode(10, 'M');
            qr.addData(url);
            qr.make();
            var wording=document.createElement('p');
            wording.innerHTML = "扫我，扫我";
            var code=document.createElement('DIV');
            code.innerHTML = qr.createImgTag();
            var element=document.getElementById("qrcode");
            element.appendChild(wording);
            element.appendChild(code);
        }
    </script>
</html>